<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "pay_score_item".
 *
 * @property integer $id
 * @property integer $ex_id
 * @property integer $log_id
 * @property integer $item_id
 * @property integer $number
 * @property integer $score
 * @property integer $logistics_state
 * @property string $logistics_trade
 * @property string $logistics_message
 * @property string $logistics_name
 * @property string $logistics_other_name
 * @property string $logistice_price
 * @property string $send_address
 * @property string $send_photo
 * @property string $accept_address
 * @property string $accept_photo
 * @property integer $admin_uid
 * @property integer $admin_time
 * @property integer $doing
 * @property string $notes
 * @property integer $send_time
 * @property integer $deliver_time
 */
class PayScoreItem extends \yii\db\ActiveRecord
{
	public $send_time_1;
	public $deliver_time_1;
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'pay_score_item';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['ex_id', 'log_id', 'item_id', 'number', 'score', 'logistics_state', 'admin_uid', 'admin_time', 'doing', 'send_time', 'deliver_time'], 'integer'],
            [['logistics_message', 'accept_address', 'notes'], 'string'],
            [['logistice_price'], 'number'],
            [['logistics_trade'], 'string', 'max' => 128],
            [['logistics_name', 'logistics_other_name'], 'string', 'max' => 64],
            [['send_address','send_time_1','deliver_time_1'], 'string', 'max' => 255],
            [['send_photo', 'accept_photo'], 'string', 'max' => 18]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'ex_id' => 'Ex ID',
            'log_id' => 'Log ID',
            'item_id' => Yii::t('app','Item ID'),
            'number' => Yii::t('app','Score Exchange Number'),
            'score' => Yii::t('app','Score Exchange Score'),
            'logistics_state' => Yii::t('app','Score Logistics State'),
            'logistics_trade' => Yii::t('app','Logistics Trade'),
            'logistics_message' => Yii::t('app','Logistics Message'),
            'logistics_name' => Yii::t('app','Logistics Name'),
            'logistics_other_name' => Yii::t('app','Logistics Other Name'),
            'logistice_price' => Yii::t('app','Logistice Price'),
            'send_address' => Yii::t('app','Send Address'),
            'send_photo' => Yii::t('app','Send Photo'),
            'accept_address' => Yii::t('app','Accept Address'),
            'accept_photo' => Yii::t('app','Accept Photo'),
            'admin_uid' => Yii::t('app','Admin Uid'),
            'admin_time' => Yii::t('app','Admin Time'),
            'doing' => Yii::t('app','Doing'),
            'notes' => Yii::t('app','Score Notes'),
            'send_time' => Yii::t('app','Logistics Send Time'),
            'send_time_1' => Yii::t('app','Logistics Send Time'),
            'deliver_time' => Yii::t('app','Logistics Deliver Time'),
            'deliver_time_1' => Yii::t('app','Logistics Deliver Time'),
        ];
    }
    //单品信息
    public function getItemInfo()
    {
    	return $this->hasOne(SysItem::className(), ['id'=>'item_id']);
    }
    //兑换配置信息
    public function getExchangeInfo()
    {
    	return $this->hasOne(PrfScoreExchange::className(), ['id'=>'ex_id']);
    }
    //兑换日志信息
    public function getLogInfo()
    {
    	return $this->hasOne(LogUserScore::className(), ['id'=>'log_id']);
    }
    //审核客服信息
    public function getAdminInfo()
    {
    	return $this->hasOne(AdminInfo::className(), ['id'=>'admin_uid']);
    }
}
